package com.sikadwafastdaisfondturbo.pretloan.utils.event.track

import android.content.Context
import androidx.room.Database
import androidx.room.Room
import androidx.room.RoomDatabase

/**
 * 埋点数据库类
 */
@Database(entities = [TrackEvent::class], version = 1,exportSchema = false)
abstract class TrackEventDatabase : RoomDatabase() {
    abstract fun eventDao(): TrackEventDao

    companion object {
        @Volatile
        private var INSTANCE: TrackEventDatabase? = null

        fun getDatabase(context: Context): TrackEventDatabase {
            return INSTANCE ?: synchronized(this) {
                val instance = Room.databaseBuilder(context.applicationContext, TrackEventDatabase::class.java, "track_event_database").build()
                INSTANCE = instance
                instance
            }
        }
    }
}